Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add static file serving support in webconsole #191

Merged

Conversation

patriciareinoso
Copy link
Contributor

@patriciareinoso patriciareinoso commented Jun 20, 2024

Description

  • This PR adds support for serving static files. Now it is possible to have a UI in front of webui.
  • This feature is enabled using go build tags. Default behavior is not changed.

Usage

Webconsole can optionally serve static files, which constitute the frontend part of the application.

To build webui with a frontend, place the static files under webconsole/ui/frontend_files before compilation.

To build the webconsole including the UI option:

make webconsole-ui

Access the UI at:

http://<webconsole-ip>:5000/

The webconsole/ui/frontend_files directory contains an example of a basic static html file that looks like this:

image

Rationale

Canonical builds its own UI for WebConsole (we call it NMS), which is currently operated as a standalone service. The goal is for us to be able to build and deploy WebConsole as one service/container, including both the backend and front end.
The NMS static files will be served by the UI service added.

Code explanation

The AddUiService method will be used from either backend/webui_service/dummy_ui_service.go or backend/webui_service/ui_service.go depending on the use of the ui build tag during the Go build process.

backend/webui_service/dummy_ui_service.go Outdated Show resolved Hide resolved
backend/webui_service/ui_service.go Outdated Show resolved Hide resolved
ui/embed.go Outdated Show resolved Hide resolved
@gab-arrobo
Copy link
Contributor

@patriciareinoso, to address the issue with the DCO check, you need to sign off your commits. That is, append the -s flag to your commits

README.md Outdated Show resolved Hide resolved
@gab-arrobo
Copy link
Contributor

@patriciareinoso, does this PR replace #143?

@patriciareinoso patriciareinoso force-pushed the serve-frontend-static-files branch 2 times, most recently from b23f2e7 to 24152f4 Compare June 21, 2024 06:56
@patriciareinoso
Copy link
Contributor Author

@patriciareinoso, does this PR replace #143?

yes

Copy link
Contributor

@gruyaume gruyaume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks good, I got a couple of comments to make the PR make more sense to people not familiar with the change

Makefile Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
patriciareinoso and others added 11 commits June 25, 2024 13:04
Signed-off-by: Patricia Reinoso <patricia.reinoso@canonical.com>
Signed-off-by: Patricia Reinoso <patricia.reinoso@canonical.com>
Signed-off-by: Patricia Reinoso <patricia.reinoso@canonical.com>
Signed-off-by: Patricia Reinoso <patricia.reinoso@canonical.com>
Signed-off-by: Patricia Reinoso <patricia.reinoso@canonical.com>
Co-authored-by: gab-arrobo <gabriel.arrobo@intel.com>
Signed-off-by: Patricia Reinoso <patricia.reinoso@canonical.com>
Co-authored-by: Guillaume Belanger <guillaume.belanger27@gmail.com>
Signed-off-by: Patricia Reinoso <patricia.reinoso@canonical.com>
Co-authored-by: Guillaume Belanger <guillaume.belanger27@gmail.com>
Signed-off-by: Patricia Reinoso <patricia.reinoso@canonical.com>
Signed-off-by: Patricia Reinoso <patricia.reinoso@canonical.com>
Signed-off-by: Patricia Reinoso <patricia.reinoso@canonical.com>
Signed-off-by: Patricia Reinoso <patricia.reinoso@canonical.com>
Signed-off-by: Patricia Reinoso <patricia.reinoso@canonical.com>
Signed-off-by: Patricia Reinoso <patricia.reinoso@canonical.com>
Copy link
Contributor

@gatici gatici left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job. This PR allows to have a UI for Webui (optionally).

@thakurajayL
Copy link
Contributor

Overall, I do not have objection in merging. Is it like Canonical copies list of static files before compilation?

  • "To build webui with a frontend, place the static files under webconsole/ui/frontend_files before compilation."

@patriciareinoso
Copy link
Contributor Author

Overall, I do not have objection in merging. Is it like Canonical copies list of static files before compilation?

  • "To build webui with a frontend, place the static files under webconsole/ui/frontend_files before compilation."

The solutions is generic so any set of frontend static files would work. At Canonical, we have a frontend implementation but its code is not meant to be added to this repo.
So, in order to have a running webui we manually copy the static files under the specified directory, compile and run the service

@patriciareinoso
Copy link
Contributor Author

@gab-arrobo @thakurajayL can we move forward and merge this?

@gab-arrobo
Copy link
Contributor

@gab-arrobo @thakurajayL can we move forward and merge this?

I am still travelling and do not have my laptop with me to take another look at it. As of last time I checked the PR, everything looked good to me.

One thing that I am wondering how it will be handled is about the process to provide support/guidance to users who want to use this capability/feature? @thakurajayL @gruyaume what are your thoughts about this?

@gruyaume
Copy link
Contributor

@gab-arrobo @thakurajayL can we move forward and merge this?

I am still travelling and do not have my laptop with me to take another look at it. As of last time I checked the PR, everything looked good to me.

One thing that I am wondering how it will be handled is about the process to provide support/guidance to users who want to use this capability/feature? @thakurajayL @gruyaume what are your thoughts about this?

For people using our distribution of SD-Core with our frontend, we have a "bug" link in the ui that points to our issue tracker. If we find that the bug is with the underlying webui code here, we'll address it.

For users who want to use their own frontend, I encourage to look at how we're doing it. This repo is publicly accessible, and I'm happy with other people using our approach. Patricia also added lines in the README to explain how to use webui with any static web files.

@thakurajayL
Copy link
Contributor

Can you confirm if you addressed the comments from Gabriel. so that it can be merged.

@patriciareinoso
Copy link
Contributor Author

Can you confirm if you addressed the comments from Gabriel. so that it can be merged.

yes, all the comments from Gabriel were taken into account

@thakurajayL thakurajayL dismissed gab-arrobo’s stale review July 16, 2024 13:58

All comments addressed and Gabriel is on PTO. Can not hold changes for long.

@thakurajayL thakurajayL merged commit 5ed83b6 into omec-project:master Jul 16, 2024
8 checks passed
@patriciareinoso patriciareinoso deleted the serve-frontend-static-files branch August 13, 2024 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants